package com.example.ffepeg.ffeImg;

public class AllSymbols {
    public static boolean isAllChineseOrEnglishSymbols(String str) {
        if (str == null || str.isEmpty()) {
            return true;
        }

        String regex = "[\\u0021-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007E" +
                "\\uFF01-\\uFF0F\\uFF1A-\\uFF20\\uFF3B-\\uFF40\\uFF5B-\\uFF65" +
                "\\u3000-\\u303F" +
                "\\s" +
                "]+";

        return str.matches(regex);
    }

    public static void main(String[] args) {
        System.out.println(isAllChineseOrEnglishSymbols(""));           // true
        System.out.println(isAllChineseOrEnglishSymbols("!@#$%^&*()")); // true
        System.out.println(isAllChineseOrEnglishSymbols("，。、！？"));   // true
        System.out.println(isAllChineseOrEnglishSymbols("!@#"));       // true
        System.out.println(isAllChineseOrEnglishSymbols(null));         // true
        System.out.println(isAllChineseOrEnglishSymbols(",,,/?!`';\\")); // true
    }

}
